package com.spzx.cart.controller;

import com.spzx.cart.service.ICartInfoService;
import com.spzx.common.core.web.domain.AjaxResult;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CartController {

    @Autowired
    private ICartInfoService cartInfoService;

    @Operation(summary = "当前登录用户加购")
    @GetMapping("/addToCart/{skuId}/{num}")
    public AjaxResult addToCart(@PathVariable("skuId") Long skuId,@PathVariable("num") Integer num){
        cartInfoService.addToCart(skuId,num);
        return AjaxResult.success();
    }
}
